#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;

const int N = 110;

void quick_sort(vector<int>& q, vector<int>& p, int l, int r)
{
    if (l >= r) return;

    int i = l - 1, j = r + 1, x = q[(l + r) >> 1];
    while (i < j)
    {
        do { i++; } while (q[i] < x);
        do { j--; } while (q[j] > x);
        if (i < j)
        {
            swap(q[i], q[j]);
            swap(p[i], p[j]);
        }
    }
    quick_sort(q, p, l, j);
    quick_sort(q, p, j + 1, r);
}

int main()
{
    int n;
    cin >> n;

    vector<int> p(n);
    vector<int> score(n);

    for (int i = 0; i < n; i++)
    {
        string s;
        cin >> s;
        p[i] = i+1;
        int cnt = count(s.begin(), s.end(), 'o');
        score[i] = -cnt;
    }

    quick_sort(score, p, 0, n - 1);

    for (int i = 0; i < n; i++)
    {
        score[i] = -score[i];
    }

    for (int i = 1; i < n; i++)
        if (score[i] == score[i - 1] && p[i] < p[i - 1]) swap(p[i], p[i - 1]);

    for (int i = 0; i < n; i++) printf("%d ", p[i]);

    return 0;
}

